package com.zemo.base.common.bean;

/**
 * @ClassName: YeeCacheKey
 * @author: SuperZemo
 * @email: zemochen@gmail.com
 * @Date 09/01/2018 21:54
 * @Description 易宝缓存KEY工具
 */
public class CacheKey {

    private static final String KEY_PREFIX = "assets:";

    /**
     * 余额支付key
     *
     * @param tradeNo
     * @return
     */
    public static String getPayBalanceKey(String tradeNo) {
        return new StringBuilder()
                .append(KEY_PREFIX)
                .append("pay:")
                .append("balance:")
                .append(tradeNo).toString();
    }

    /**
     * 美通卡支付key
     *
     * @param tradeNo
     * @return
     */
    public static String getPayWumartKey(String tradeNo) {
        return new StringBuilder()
                .append(KEY_PREFIX)
                .append("pay:")
                .append("wumart:")
                .append(tradeNo).toString();
    }

    /**
     * 新百支付key
     *
     * @param tradeNo
     * @return
     */
    public static String getPayXinBaiKey(String tradeNo) {
        return new StringBuilder()
                .append(KEY_PREFIX)
                .append("pay:")
                .append("xinbai:")
                .append(tradeNo).toString();
    }

    /**
     * 余额退款key
     *
     * @param refundNo
     * @return
     */
    public static String getRefundBalanceKey(String refundNo) {
        return new StringBuilder()
                .append(KEY_PREFIX)
                .append("refund:")
                .append("balance:")
                .append(refundNo).toString();
    }

    /**
     * 美通卡退款key
     *
     * @param refundNo
     * @return
     */
    public static String getRefundWumartKey(String refundNo) {
        return new StringBuilder()
                .append(KEY_PREFIX)
                .append("refund:")
                .append("wmart:")
                .append(refundNo).toString();
    }

    /**
     * 新百卡退款key
     *
     * @param refundNo
     * @return
     */
    public static String getRefundXinBaiKey(String refundNo) {
        return new StringBuilder()
                .append(KEY_PREFIX)
                .append("refund:")
                .append("xinbai:")
                .append(refundNo).toString();
    }

    /**
     * 免密支付配置
     *
     * @param payway
     * @return
     */
    public static String getFreeConfigKey(int payway) {
        return new StringBuilder()
                .append(KEY_PREFIX)
                .append("config:")
                .append("free:")
                .append(payway).toString();
    }
}
